<?php
include_once(dirname(__FILE__) . "/service-adapter-base.php");

class ImMessageExchangeAdapter extends ServiceAdapterBase {
  function __construct() {
    parent::__construct('10.121.215.88', '9191');
    // parent::__construct('10.16.15.197', '9191');
    $this->service_ = new MessageExchangeServiceClient($this->protocol_);
  }

  protected function LoadIDL() {
    include_once $GLOBALS['THRIFT_GEN_ROOT'].'/BaseService/BaseService_types.php';
    include_once $GLOBALS['THRIFT_GEN_ROOT'].'/BaseService/BaseService.php';
    include_once $GLOBALS['THRIFT_GEN_ROOT'].'/ImServiceCommon/ImServiceCommon_types.php';
    include_once $GLOBALS['THRIFT_GEN_ROOT'].'/MessageExchangeService/MessageExchangeService.php';
    include_once $GLOBALS['THRIFT_GEN_ROOT'].'/MessageExchangeService/MessageExchangeService_types.php';
  }

  function CreateMessage($message) {
    try {
      $this->service_->CreateMessage($message);
    } catch (TException $tx) {
      print 'CreateMessage err\r\n';
      echo $tx;
      return -1;
    }
    return 0;
  }
}

?>
